home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Pascal / Applications / NIH Image 1.59 / Macros / Movie Making < prev    next >
Encoding:
Text File  |  1995-07-06  |  7.1 KB  |  122 lines  |  [TEXT/Imag]

  1. ax;
  2.   yscale:=pheight/ymax;
  3.   yscale2:=pheight/(PlotData[nFrames]);
  4.   SetForeground(255);
  5.   SetBackground(0); 
  6.   SetLineWidth(1);
  7.   for i:=2 to nFrames do begin
  8.      interval := PlotData[i]-PlotData[i-1];
  9.      x:=margin+(i-1)*xscale;
  10.      y:=pbottom-interval*yscale;
  11.      MoveTo(x, pBottom);
  12.      LineTo(x,y);
  13.      MoveTo(margin+(i-2)*xscale, pBottom-(PlotData[i-1])*yscale2);
  14.      LineTo(margin+(i-1)*xscale, pBottom-(PlotData[i])*yscale2);
  15.   end;
  16.   KillRoi;
  17.   MoveTo(margin, margin);
  18.   LineTo(margin, margin+pheight);
  19.   LineTo(margin+pwidth, margin+pheight);
  20.   SetFont('Geneva');
  21.   SetFontSize(9);
  22.   SetText('Right Justified');
  23.   MoveTo(margin-2, margin+pheight-5);
  24.   writeln(ymin:1:3);
  25.   MoveTo(margin-2, margin);
  26.   writeln(ymax:1:3);
  27.   SetText('Left Justified');
  28.   x := margin+pwidth+10;
  29.   y := margin;
  30.   yinc := 12;
  31.   MoveTo(x, y);
  32.   writeln('frames=', nFrames:1);
  33.   y := y+yinc;
  34.   MoveTo(x, y);
  35.   writeln('expected time=', nFrames*reqInterval:1:4);
  36.   y := y+yinc;
  37.   MoveTo(x, y);
  38.   writeln('actual time=', TotalTime:1:4);
  39.   y := y+yinc;
  40.   MoveTo(x, y);
  41.   writeln('req. interval=', reqInterval:1:4);
  42.   y := y+yinc;
  43.   MoveTo(x, y);
  44.   writeln('avg interval=', avgInterval:1:4);
  45.   y := y+yinc;
  46.   MoveTo(x, y);
  47.   writeln('min interval=', minInterval:1:4);
  48.   y := y+yinc;
  49.   MoveTo(x, y);
  50.   writeln('max interval=', maxInterval:1:4);
  51.   y := y+yinc;
  52.   MoveTo(x, y);
  53.   if reqInterval <> 0.0 then
  54.      writeln('expected rate=', 1/reqInterval:1:3,' fps');
  55.   y := y+yinc;
  56.   MoveTo(x, y);
  57.   writeln('actual rate=', (nFrames)/TotalTime:1:3,' fps');
  58.  RestoreState;
  59. end;
  60.  
  61. macro 'Make Movie and Plot Intervals [M]';
  62. var
  63.   i, nFrames, x, y, w, h: integer;
  64.   avgInterval: real;
  65. begin
  66.   GetRoi(x, y, w, h);
  67.   if w = 0 then begin
  68.      PutMessage('Selection Required.');
  69.      exit;
  70.   end;
  71.   MakeMovie('dialog, time-stamp', -1, -1);
  72.   nFrames := PlotData[0];
  73.   PlotFrameIntervals(nFrames); 
  74. end;
  75.  
  76.  
  77. Macro 'Frame Rate vs. Frame Size';
  78. var
  79.   n, i, width, height,w,h:integer;
  80.   avgFrameInterval: real;
  81. begin
  82.    n := 50;
  83.    StartCapturing;
  84.    GetPicSize(width, height);
  85.    SetFont('Monaco');
  86.    SetFontSize(9);
  87.    NewTextWindow('Rate vs. Size', 150, 400);
  88.    MoveWindow(750, 50);
  89.    SaveState;
  90.    for i := 1 to n do begin
  91.      SelectWindow('Camera');
  92.      w := round(width*(i/n));
  93.       h := round(height*(i/n));
  94.       w := w - (w mod 4);
  95.       h := h - (h mod 4);
  96.      MakeRoi(0, 0, w, h);
  97.      MakeMovie('blind', 10, 0);
  98.      avgFrameInterval := GetSliceSpacing;
  99.      Dispose;
  100.      SelectWindow('Rate vs. Size');
  101.      writeln(i:3, avgFrameInterval:6:3, '  ', w:1:0, 'x', h:1:0 );
  102.   end;
  103.   RestoreState;
  104. end;
  105.  
  106.  
  107. macro 'Projection Example';
  108. begin
  109.    SetProjection('Initial Angle', 0);
  110.    SetProjection('Total Rotation', 360);
  111.    SetProjection('Rotation Increment', 30);
  112.    SetDensitySlice(0, 254);   {sets transparency bounds}
  113.    SetProjection('Surface Opacity', 50);
  114.    SetProjection('Surface Depth-Cueing', 50);
  115.    SetProjection('Interior Depth-Cueing', 50);
  116.    SetProjection('Save Projections', false);
  117.    SetProjection('Minimize Size', true);
  118.    SetProjection('Y-Axis');
  119.    SetProjection('Brightest Point');
  120.    Project; {Dialog is not displayed}
  121. end.
  122.